/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package states;

/**
 *
 * @author billkress
 */
public class State implements IState {

    private final String name;

    /**
     * Constructor to force a name to be used
     * @param name name used for logging purposes
     */
    public State(String name) {
        this.name = name;
    }

    /**
     * This event will be called when switiching to this state.  If this
     * state is the "Initial" state (passed into StateEngine constructor)
     * it will not be called.
     * 
     * If a value is returned, it this state + the returned Event MUST
     * be in the transaction table (to ensure the transaction table is
     * complete--it is as much of a programmer reference as runnable code!)
     * 
     * 
     * @param cause
     * @return any state but NULL causes the system to go straight to that state.
     */
    public IEvent entryAction(IEvent cause) {
        return null;
    }

    /**
     * Like entryActon, but called as we are transitioning out of this state.
     * This one cannot cause a state change by returning an event like entryAction
     * can
     * @param cause the event that caused us to exit this state
     */
    public void exitAction(IEvent cause) {

    }

    /**
     * for logging purposes
     * @return the name passed into the constructor.
     */
    public String toString() {
        return name;
    }
}
